<@_content id=id>
	<#assign a=object/>
	<#assign id=a.id/>
	<#assign parentId=a.parentId!/>
	<#assign categoryId=a.categoryId!/>
	<#assign modelId=a.modelId!/>
	<#assign attribute=getContentAttribute(a.id)!/>
</@_content>
<@_category id=categoryId!><#assign category=object/></@_category>
<@_model id=modelId!><#assign model=object/></@_model>
<script>
function clickAddTag(){
	$('.tags .button',navTab.getCurrentPanel()).click();
}
</script>
<form method="post" action="cmsContent/save.do?callbackType=closeCurrent&navTabId=cmsContent/list" class="pageForm required-validate" onsubmit="clickAddTag(); return validateCallback(this,navTabAjaxDone);">
	<input name="id" type="hidden" value="${id!}" />
	<input name="parentId" type="hidden" value="${parentId!}" />
	<div class="formBar">
		<ul>
			<li>
				<label><input type="checkbox" name="draft"/>保存为草稿</label>
			</li>
			<@_sysAuthorized roleIds=admin.roles url='cmsContent/check'>
				<li>
					<label><input type="checkbox" name="checked" onclick="if($(this).is(':checked')){$('input[name=draft]',navTab.getCurrentPanel()).parent().parent().hide();}else{$('input[name=draft]',navTab.getCurrentPanel()).parent().parent().show();}"/>直接审核通过</label>
				</li>
			</@_sysAuthorized>
			<li><button type="submit" class="buttonActive">保存</button></li>
			<li><button type="button" class="button close">关闭</button></li>
		</ul>
	</div>
	<div class="tabs">
		<div class="tabsHeader">
	        <div class="tabsHeaderContent">
	            <ul>
					<li><a href="javascript:;" onclick="return false;">基础信息</a></li>
					<li><a href="javascript:;" onclick="return false;">推荐信息</a></li>
	            </ul>
	        </div>
	    </div>
	    <div class="tabsContent unitBox">
			<div class="pageFormContent" layoutH="96">
		<#if model?has_content>
			<#assign fieldList=model.fieldList![]/>
			<#assign requiredFieldList=model.requiredFfieldList![]/>
			<@_content id=parentId>
				<dl class="nowrap">
				    <dt>父内容:</dt>
					<dd>
					    ${(object.title)!}
					</dd>
			    </dl>
			</@_content>
			<dl>
				<dt>分类:</dt>
				<dd>
					<input name="categoryId" type="hidden" value="${categoryId!}"/>
					${(category.name)!}
				</dd>
			</dl>
			<dl>
				<dt>模型:</dt>
				<dd>
					<input name="modelId" type="hidden" value="${modelId!}"/>
					${(model.name)!}
				</dd>
			 </dl>
		 	 <dl class="nowrap">
		        <dt>${(model.fieldTextMap['title'])!}:</dt>
				<dd>
					<input class="required" name="title" type="text" maxlength="250" size="60" value="${(a.title)!}"/>
			<#if fieldList?seq_contains('copied')>
					<label><input name="copied" type="checkbox"/>${(model.fieldTextMap['copied'])!}</label>
<script>
$('input[name=copied]',navTab.getCurrentPanel()).click(function(){
	if($(this).is(':checked')) {
	    $('.copied',navTab.getCurrentPanel()).show();
	    $('.copied input[type=text]',navTab.getCurrentPanel()).addClass('required');
	} else {
		$('.copied',navTab.getCurrentPanel()).hide();
		$('.copied input[type=text]',navTab.getCurrentPanel()).removeClass('required').val('');
	}
});
</script>
			</#if>
			        </dd>
			    </dl>
				<dl class="copied" style="display:none">
					<dt>${(model.fieldTextMap['source'])!}:</dt>
					<dd><input name="source" type="text" maxlength="50" size="20" value="${(attribute.source)!}"/></dd>
				</dl>
			    <dl class="copied" style="display:none">
					<dt>${(model.fieldTextMap['sourceUrl'])!}:</dt>
					<dd><input class="url" name="sourceUrl" type="text" maxlength="250" size="20" value="${(attribute.sourceUrl)!}"/></dd>
				</dl>
			<#if a?has_content&&a.copied&&fieldList?seq_contains('copied')>
<script>
$('input[name=copied]',navTab.getCurrentPanel()).click();
</script>
			</#if>
			<#if model.onlyUrl>
				<dl class="nowrap">
					<dt>${(model.fieldTextMap['url'])!}:</dt>
					<dd>
						<input name="url" type="text" maxlength="1000" size="60" value="${(a.url)!}"/>
					</dd>
				</dl>
			</#if>
			<#if fieldList?seq_contains('tag')>
			     <#include "../include_page/tags.html"/>
                 <#assign tagTypeIds=category.tagTypeIds!''/>
                 <#assign tagIds=(a.tagIds)!''/>
                 <#assign tagText=(model.fieldTextMap['tag'])!''/>
                 <@tags tagText tagTypeIds tagIds/>
			</#if>
			<#if fieldList?seq_contains('author')>
			    <dl>
				    <dt>${(model.fieldTextMap['author'])!}:</dt>
				    <dd><input name="author"<#if requiredFieldList?seq_contains('author')> class="required"</#if> type="text" maxlength="50" size="20" value="${(a.author)!}"/></dd>
			    </dl>
			</#if>
			<#if fieldList?seq_contains('editor')>
				<dl>
					<dt>${(model.fieldTextMap['editor'])!}:</dt>
					<dd><input name="editor"<#if requiredFieldList?seq_contains('author')> class="required"</#if> type="text" maxlength="50" size="20" value="${(a.editor)!}"/></dd>
				</dl>
			</#if>
			<#if fieldList?seq_contains('description')>
				<dl class="nowrap">
					<dt>${(model.fieldTextMap['description'])!}:</dt>
					<dd>
					    <textarea name="description"<#if requiredFieldList?seq_contains('author')> class="required"</#if> maxlength="280" cols="80" rows="4">${(a.description)!}</textarea>
					</dd>
				</dl>
			</#if>
				<dl>
					<dt>定时发布:</dt>
					<dd>
					  <input name="timing" type="checkbox" onclick="if($(this).is(':checked')){$('#publishDate',navTab.getCurrentPanel()).show();$('input[name=publishDate]',navTab.getCurrentPanel()).addClass('required').addClass('valid')}else{$('#publishDate',navTab.getCurrentPanel()).hide();$('input[name=publishDate]',navTab.getCurrentPanel()).removeClass('required').removeClass('valid')}"/>
					</dd>
				</dl>
				<dl id="publishDate" style="display:none">
					<dt>发布日期:</dt>
					<dd>
						<input type="text" name="publishDate" class="date" size="20" dateFmt="yyyy-MM-dd HH:mm:ss" value="${(a.publishDate)!}"/>
						<a class="inputDateButton" href="javascript:;" onclick="return false;">选择</a>
					</dd>
				</dl>
			<#if a?has_content&&a.publishDate gt .now>
<script>
$('input[name=timing]',navTab.getCurrentPanel()).click();
</script>
			</#if>
			<#if fieldList?seq_contains('cover')>
				<dl class="nowrap">
					<dt>${(model.fieldTextMap['cover'])!}:</dt>
					<dd>
						<input name="cover"<#if requiredFieldList?seq_contains('author')> class="required"</#if> value="${(a.cover)!}" maxlength="300" size="50" type="text"/>
						<a class="btnAttach" href="common/upload.html?field=cover&onlyImage=true" lookupGroup="" width="560" height="300">${model.coverText!}</a>
						<#include "../include_page/preview.html"/>
						<@preview 'content' 'input[name=cover]'/>
					</dd>
				</dl>
			</#if>
			<#include "../include_page/extendData.html"/>
			<#if category?has_content&&category.extendId?has_content>
				 <@_sysExtendFieldList extendId=category.extendId>
					<#assign extendList=list![]/>
					<#assign extendValue=attribute!{}/>
					<@extendData 'categoryExtendDataList' extendList extendValue/>
				 </@_sysExtendFieldList>
			</#if>
			<#assign extendList=model.extendList![]/>
			<#assign extendValue=attribute!{}/>
			<@extendData 'modelExtendDataList' extendList extendValue/>
			<#if fieldList?seq_contains('content')>
				<dl class="nowrap">
					<dt>${(model.fieldTextMap['content'])!}:</dt>
					<dd style="width:90%">
						<textarea name="text" class="editor<#if requiredFieldList?seq_contains('author')> required</#if>" editorType="${model.editorType!}">${(attribute.text)!}</textarea>
					</dd>
				</dl>
			</#if>
			<#if model.hasImages||model.hasFiles>
				<#include "../include_page/contentFiles.html"/>
				<#if model.hasImages>
					<@contentFiles true id!/>
				</#if>
				<#if model.hasFiles>
					<@contentFiles false id!/>
				</#if>
			</#if>
		</#if>
            </div>
			<div class="pageFormContent" layoutH="96">
				<#include "../include_page/related.html"/>
				<@related id!/>
			</div>
		</div>
	</div>
</form>